package conexion;
import java.sql.*;
import javax.swing.JOptionPane;

public class ConexionSql {

public static Statement conectarse (){
  try
        {
       Class.forName("com.mysql.jdbc.Driver").newInstance();//instanciacion sql
       Connection conn=
               DriverManager.getConnection("jdbc:mysql://127.0.0.1/BDBomberos","SAVE","witsoft");//host y base d datos, user,password
Statement ste = conn.createStatement();
return ste;
}
   catch (Exception e)
        {

       JOptionPane.showMessageDialog(null,"ERROR CON LA CONEXION A\nLA BASE DE DATOS ","ERROR"+e,JOptionPane.ERROR_MESSAGE);
        }
  return null;
}
public static void desconectarse (Statement a){
        try {
            a.close();
        } catch (SQLException ex) {
  JOptionPane.showMessageDialog(null,"La conexion ya fue cerrada");
        }
}
}
